public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree.TreeNode root= binaryTree.createTree();
        /*binaryTree.preOrder(root);
        System.out.println();
        binaryTree.midOrder(root);
        System.out.println();
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("========求节点==========");
        System.out.println(binaryTree.size(root));
        binaryTree.size2(root);
        System.out.println(BinaryTree.sizeNode);
        System.out.println("=========求叶子节点=========");
        System.out.println(binaryTree.getLeafNodeCount(root));
        binaryTree.getLeafNodeCount2(root);
        System.out.println(BinaryTree.sizeLeafNode);
        System.out.println("=======求k行的节点===========");
        System.out.println(binaryTree.getKLevelNodeCount(root, 1));
        System.out.println(binaryTree.getKLevelNodeCount(root, 2));
        System.out.println(binaryTree.getKLevelNodeCount(root, 3));
        System.out.println(binaryTree.getKLevelNodeCount(root, 4));
        System.out.println("========求树高==========");
        System.out.println(binaryTree.getHeight(root));
        System.out.println("=========找节点=========");
        BinaryTree.TreeNode ret=binaryTree.find(root, 'Z');
        if (ret!=null){
            System.out.println(ret.val);
        }else {
            System.out.println(ret);
        }
        System.out.println("=========是否相同=========");
        BinaryTree.TreeNode root2= binaryTree.createTree1();
        System.out.println(binaryTree.isSameTree(root, root2));
        System.out.println("=========是否为子树=========");
        BinaryTree.TreeNode root3= binaryTree.createTree3();
        System.out.println(binaryTree.isSubTree(root, root3));
        System.out.println("=======翻转===========");
        binaryTree.reverseTree(root);
        binaryTree.preOrder(root);
        System.out.println();
        System.out.println("========完全二叉树==========");
        System.out.println(binaryTree.isBalanced2(root));
        BinaryTree.TreeNode root4= binaryTree.createTree4();
        System.out.println(binaryTree.isBalanced2(root4));
        System.out.println("=========对称二叉树=========");
        BinaryTree.TreeNode root5= binaryTree.createTree5();
        System.out.println(binaryTree.isSymmetric(root5));
        System.out.println("========层序遍历==========");
        binaryTree.levelOrder(root);*/
        System.out.println("=========前序=========");
        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.preOrder2(root);
        System.out.println();
        binaryTree.preOrder3(root);
        System.out.println("=========中序=========");
        binaryTree.midOrder(root);
        System.out.println();
        binaryTree.midOrder2(root);
        System.out.println("=========后序=========");
        binaryTree.postOrder(root);
        System.out.println();
        binaryTree.postOrder2(root);
        System.out.println("=========前序和中序=》后序=========");
        char[] ch1=new char[]{'A','B','D','E','H','C','F','G'};
        char[] ch2=new char[]{'D','B','E','H','A','F','C','G'};
        BinaryTree.TreeNode root10=binaryTree.buildTreePM(ch1,ch2);
        binaryTree.postOrder2(root10);
        System.out.println();
        System.out.println("=======中序和后序=》前序===========");
        char[] ch3=new char[]{'D','B','E','H','A','F','C','G'};
        char[] ch4=new char[]{'D','H','E','B','F','G','C','A'};
        BinaryTree.TreeNode root11=binaryTree.buildTreeMP(ch3,ch4);
        binaryTree.preOrder(root11);
        System.out.println();
        System.out.println("=========二叉树变为字符串=========");
        System.out.println(binaryTree.tree2str(root));
    }

}
